package com.example.jdimust.value;

/**
 * Author: MaZongyang
 * Date: 2021/5/20/0020 12:45
 * Description:
 */
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.example.jdimust.R;

import java.util.List;

public class ValueAdapter extends ArrayAdapter<Value> {
    private int resourceId;

    public ValueAdapter(Context context, int textViewResourceId, List<Value> objects) {

        super(context, textViewResourceId, objects);
        resourceId = textViewResourceId;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        Value mvalue = getItem(position);
        @SuppressLint("ViewHolder")
        View view = LayoutInflater.from(getContext()).inflate(resourceId, parent, false);
        TextView valueKey = (TextView) view.findViewById(R.id.value_lv_valueKey);
        TextView keyvalue = (TextView) view.findViewById(R.id.value_lv_value);
        TextView keycrttime = (TextView) view.findViewById(R.id.value_lv_crttime);
        valueKey.setText(mvalue.getValueKey());
        keyvalue.setText(mvalue.getValue());
        keycrttime.setText(mvalue.getCreateTime());
        return view;

    }
}
